package J20250330_real;

/**
 * Created with IntelliJ IDEA.
 * Description:最大子矩阵——https://www.lanqiao.cn/paper/3876/problem/2485/
 * User: 王圆豪
 * Date: 2025-03-30
 * Time: 21:29
 */

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main {
    static char[][] table;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        table = new char[20][20];
        for(int i = 0; i < 20; i++){
            String s = scan.nextLine();
            table[i] = s.toCharArray();
        }
//        for(int i = 0; i < 20; i++){
//            for(int j = 0; j < 20; j++){
//                System.out.print(table[i][j]);
//            }
//            System.out.println();
//        }
         int max = 0;
         for(int i = 0; i <= 15; i++){
           for(int j = 0; j <= 15; j++){
             max = Math.max(func(i,j), max);
           }
         }
         System.out.println(max);
        scan.close();
    }

    static int func(int x, int y){
        int ret = 0;
        for(int i = x; i < x+5; i++){
            for(int j = y; j < y+5; j++){
                ret += table[i][j] - '0';
            }
        }
        return ret;
    }
}